<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="test"></div>
    <script src="../lib/react.development.js"></script>
    <script src="../lib//react-dom.development.js"></script>
    <script src="../lib/babel.min.js"></script>
    <script type="text/babel"> 
    class MyComponent extends React.Component{
       state={isHot:true}
        change=()=>{
         this.isHot=!this.isHot
         console.log(this.input.value)
        }
        click=()=>{
            const {isHot}=this.state
            this.setState({isHot:!isHot})//及时更新数据
            console.log(this.input.value)//输出时带了两个参数:1.将前面的值置为空,2.拿到的真实值
            //但是ref所带来的问题可忽略,而且实际开发中用的也多(方便)
        }
        render(){
            return(
                <div>
                <h2>ref问题所在:</h2>
                <input type="text" placeholder="请输入内容" ref={(c)=>{this.input=c;console.log('@',c)}} onBlur={this.change}/>   
                <button onClick={this.click}>点击</button>
                </div>
            )
        }
    }
    ReactDOM.render(<MyComponent/>,document.getElementById('test'))
    </script>
</body>
</html>